package com.atguigu.day20.work;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Work1 {
    public static void main(String[] args) {
        String str="Your future depends on your dreams, so go to sleep.";
        str=str.replaceAll("[^a-zA-z]","");
        HashMap<Character,Integer>map=new HashMap<>();
        char[]arr=str.toCharArray();
        for (int i = 0; i < arr.length; i++) {
            if (map.containsKey(arr[i])){
                Integer count=map.get(arr[i]);
                map.put(arr[i],count+1);
            }else{
                map.put(arr[i],1);
            }
        }
        Set<Map.Entry<Character, Integer>> entries = map.entrySet();
        for (Map.Entry<Character, Integer> entry : entries) {
            System.out.println(entry);
        }
    }
}
